Crate libadwaita

Source
Expand description

§Rust Adwaita bindings

This library contains safe Rust bindings for Adwaita, a library that offers building blocks for modern GNOME applications.

See also

§Example

Adwaita needs to be initialized before use. This can be done by either:

The libadwaita crate is usually renamed to adw. You can do this globally in your Cargo.toml file:

[dependencies.adw]
package = "libadwaita"
version = "0.x.y"
use adw::prelude::*;

use adw::{ActionRow, Application, ApplicationWindow, HeaderBar};
use gtk::{Box, ListBox, Orientation, SelectionMode};

fn main() {
    let application = Application::builder()
        .application_id("com.example.FirstAdwaitaApp")
        .build();

    application.connect_activate(|app| {
        // ActionRows are only available in Adwaita
        let row = ActionRow::builder()
            .activatable(true)
            .title("Click me")
            .build();
        row.connect_activated(|_| {
            eprintln!("Clicked!");
        });

        let list = ListBox::builder()
            .margin_top(32)
            .margin_end(32)
            .margin_bottom(32)
            .margin_start(32)
            .selection_mode(SelectionMode::None)
            // makes the list look nicer
            .css_classes(vec![String::from("boxed-list")])
            .build();
        list.append(&row);

        // Combine the content in a box
        let content = Box::new(Orientation::Vertical, 0);
        // Adwaitas' ApplicationWindow does not include a HeaderBar
        content.append(&HeaderBar::new());
        content.append(&list);

        let window = ApplicationWindow::builder()
            .application(app)
            .title("First App")
            .default_width(350)
            // add content to window
            .content(&content)
            .build();
        window.present();
    });

    application.run();
}

Re-exports§

Modules§

Structs§

  • GLib type: GObject with reference counted clone semantics.
  • AboutWindowDeprecatedv1_2
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • Bannerv1_3
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: Boxed type with copy-on-clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • Dialogv1_5
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • FlapDeprecated
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • Layoutv1_6
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • LeafletDeprecated
    GLib type: GObject with reference counted clone semantics.
  • LeafletPageDeprecated
    GLib type: GObject with reference counted clone semantics.
  • MessageDialogDeprecatedv1_2
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: Shared boxed type with reference counted clone semantics.
  • SqueezerDeprecated
    GLib type: GObject with reference counted clone semantics.
  • SqueezerPageDeprecated
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • Togglev1_7
    GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.
  • GLib type: GObject with reference counted clone semantics.

Enums§

Functions§